package com.sky.entity;

import lombok.Data;
import lombok.AllArgsConstructor;
import lombok.NoArgsConstructor;
import lombok.Builder;
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.mapping.Document;
import org.springframework.data.mongodb.core.mapping.Field;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Document(collection = "note")  // 指定MongoDB集合名称
public class Note implements Serializable {
    private static final long serialVersionUID = 1L;
    /**
     * 笔记发布状态 0待审核 1通过 2拒绝
     */
    public static final Integer PENDING_REVIEW = 0;
    public static final Integer APPROVED = 1;
    public static final Integer REJECTED = 2;
    @Id
    private String id;  // MongoDB自动生成的_id
    @Field("u_id")
    private Integer uId;  //用户ID
    @Field("b_id")
    private String bId; //书籍ID
    private String title;
    private String content;  // 存储HTML内容
    private List<String> images;  // 图片URL列表
    private List<String> tags;  // 标签列表
    @Field("status")
    private Integer status;
    @Field("createTime")
    private Date createTime;  // 使用Date类型存储ISO时间
    @Field("updateTime")
    private Date updateTime;
}